package com.guazai.project.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.guazai.common.pojo.InterfaceInfo;
import com.guazai.project.model.dto.interfaceinfo.InterfaceInfoInvokeRequest;
import com.guazai.project.model.dto.interfaceinfo.InterfaceInfoQueryRequest;
import com.guazai.project.model.vo.AnalysisVO;
import com.guazai.project.model.vo.InterfaceInfoVO;
import com.guazai.project.model.vo.TopInterfaceInfoVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author guazai
* @description 针对表【interface_info(接口信息)】的数据库操作Service
* @createDate 2024-07-14 00:01:01
*/
public interface InterfaceInfoService extends IService<InterfaceInfo> {

    /**
     *
     * @param interfaceInfo
     * @param add
     */
    void validInterfaceInfo(InterfaceInfo interfaceInfo, boolean add);

    /**
     * 调用接口方法
     *
     * @param invokeRequest
     * @param request
     * @return
     */
    String invokeInterfaceInfo(InterfaceInfoInvokeRequest invokeRequest,
                                            HttpServletRequest request);

    /**
     * 获得最热门的一些接口
     * @return
     */
    List<AnalysisVO> getTopInterfaceInfo();

    /**
     * 分页查询InterfaceInfoVO
     *
     * @param interfaceInfoQueryRequest
     * @return
     */
    Page<InterfaceInfoVO> listInterfaceInfoVOByPage(InterfaceInfoQueryRequest interfaceInfoQueryRequest);

    Long getInterfaceInfoTotalInvokesCount();

    /**
     * 获得热门接口信息和最热门接口
     * @return
     */
    TopInterfaceInfoVO getTop();

    /**
     * 将数据库中用户的剩余调用次数加载进redis中
     */
    void loadInRedis();
}
